home *** CD-ROM | disk | FTP | other *** search
- property pSpr, pMinLeft, pMaxRight, pChannels
-
- on beginSprite me
- channelList = []
- pChannels = string(pChannels)
- repeat with X = 1 to the number of items in pChannels
- add(channelList, integer(item X of pChannels))
- end repeat
- pChannels = channelList
- pSpr = sprite(me.spriteNum)
- pMinLeft = 359
- pMaxRight = 450
- mUpdate(me)
- end
-
- on mUpdate me
- pSpr.locH = pMinLeft + (the volume of sound pChannels[1] / 255.0 * (pMaxRight - pMinLeft))
- end
-
- on mUpdateVolumeSlider me
- global gMuteAllSounds, gMuted, gMusicChan
- if gMuteAllSounds then
- toggleMute(1)
- end if
- if pChannels[1] = gMusicChan then
- gMuted = 0
- end if
- mUpdate(me)
- playBeepSound(the volume of sound pChannels[1])
- end
-
- on mouseDown me
- repeat while the stillDown
- pSpr.locH = min(max(pMinLeft, the mouseH), pMaxRight)
- updateStage()
- end repeat
- end
-
- on mouseUp me
- mid = pSpr.locH - pMinLeft
- percent = float(mid) / (pMaxRight - pMinLeft)
- newVolume = integer(255 * percent)
- repeat with chan in pChannels
- set the volume of sound chan to fixVolume(newVolume)
- end repeat
- mUpdateVolumeSlider(me)
- end
-
- on getPropertyDescriptionList me
- return [#pChannels: [#format: #string, #comment: "Channels?", #default: 1]]
- end
-